lambda_b = 0.1:0.01:0.9;
lambda_g = 1-lambda_b;

gamma = 0.2; 
theta_b = 1;
theta_g = 1;
p = 1;
q = 0.1;

n = length(lambda_b);


x0 = [0,0,0,0];
A = [];
b = [];
Aeq = [];
beq = [];
lb = [];
ub =[];
%options = optimoptions('fmincon','Display','iter');

X_sol = ones(n,4);

for i =1:n
[X_sol(i,:),fval] = fmincon(@(X)Fig2_solve(X,lambda_b(i),lambda_g(i),gamma,theta_b,theta_g,p,q),x0,A,b,Aeq,beq,lb,ub);
end

x_b = X_sol(:,1);
y_b = X_sol(:,2);
x_g = X_sol(:,3);
y_g = X_sol(:,4);


plot(lambda_b,x_b,'-',lambda_b,y_b,'--',lambda_b,x_g,'g--x',lambda_b,y_g,'--o','Linewidth',1.5)
legend("\bf x_B","\bf y_B","\bf x_G","\bf y_G",'Location','northwest')
xlabel('\bf\lambda_{B}:boy''s bargaining power') 


